﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CountType
{
    class CountType
    {
        //输入一行字符串，分别统计出其中英文字母、数字、空格的个数。
        static void Main(string[] args)
        {

            int countLetterSmall = 0;
            int countLetterBig = 0;
            int countNum = 0;
            int countWhiteSpace = 0;
            Console.WriteLine("请输入一串字符");
            string str = Console.ReadLine();

            foreach (var item in str)
            { 
                if ((int)item >= 97 & (int)item >= 122) {
                    countLetterSmall++;
                } else if ((int)item >= 65 & (int)item >= 90) {
                    countLetterBig++;
                } else if ((int)item >= 48 & (int)item <= 57) {
                    countNum++;
                } else if ((int)item == 32) {
                    countWhiteSpace++;
                }else {
                    continue;
                }
            }
            
            Console.WriteLine("字母数:{0} 数字数:{1} 空格数{2} ",(countLetterBig+countLetterSmall),countNum,countWhiteSpace); 
        }
    }
}
